﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Dynamics.Enums;
using DAL;

namespace BLL
{
    public class LogProvider : BaseProvider
    {
        public static void SaveLog(LogType logType, string description)
        {
            Log log = new Log();
            log.Type = (byte)logType;
            log.Description = description;
            log.Date = DateTime.Now;
            new LogProvider().Add(log);
        }

        public static void SaveLog(LogType logType, string content, string description)
        {
            Log log = new Log();
            log.Type = (byte)logType;
            log.Description = description;
            log.Content = content;
            log.Date = DateTime.Now;
            new LogProvider().Add(log);
        }

        public static void SaveLog(LogType logType, DataSource source, string description)
        {
            SaveLog(logType, source, null, description);
        }

        public static void SaveLog(LogType logType, DataSource source, string content, string description)
        {
            Log log = new Log();
            log.Source = (byte)source;
            log.Type = (byte)logType;
            log.Description = description;
            log.Content = content;
            log.Date = DateTime.Now;
            new LogProvider().Add(log);
        }
    }
}
